Fix/terminal image rendering - #1084
Conversation
…G payloads getKittyFormat() now always returns 100 (PNG) — the only format id that all kitty-protocol terminals guarantee. Non-PNG payloads (JPEG, WebP, GIF) are converted to PNG via Jimp before transmission, so the bytes always match f=100. This prevents terminals from silently dropping images due to fabricated format ids (101-104) that don't exist in the kitty spec. renderInlineImage() is now async to support the Jimp conversion step. image-block.tsx and image-card.tsx updated to handle async with useEffect + state. New tests validate that the escape sequence uses only spec-compliant format ids (f=24|32|100) across all media types, and that no fabricated ids (101-104) appear in any chunk. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
PR checks failedA couple of things need fixing before this can be reviewed. Title looks like a branch name. Titles such as Your title: Edit the PR and this check re-runs automatically. |
|
The core diagnosis is right and worth porting: But the PR is much bigger than its title suggests and mixes unrelated changes:
As submitted this reads like three or four PRs squashed together, several of which depend on an unmerged PR, which makes it hard for a maintainer to port cleanly by hand. Please split into: (1) the kitty format-id + chunking + iTerm2 size fix with its tests, and (2) the new terminal detection / clipboard fallback work as separate, independently reviewable PRs. |
What
Fixes getKittyFormat() which invented format ids (101/102/103/104) that don't exist in the Kitty graphics protocol spec. The spec only defines f=24 (RGB), f=32 (RGBA), and f=100 (PNG).
Non-PNG payloads (JPEG, WebP, GIF) produced by the compression pipeline are now converted to PNG via Jimp before transmission, so the bytes always match f=100 . This prevents kitty/WezTerm/Ghostty terminals from silently dropping images.
Why
The original getKittyFormat() returned fabricated ids — f=102 for JPEG, f=103 for WebP, f=104 for GIF. Since image-handler compresses large images to JPEG, sending those bytes with f=102 to a real terminal causes the terminal to either error or silently drop the image (it has no such format). The tests only asserted the escape sequence contained f=102 , not that any real terminal accepts it.
Changes
New tests
Validation
Note
This PR builds on #1 (terminal detection + pwsh fallback). Merge that first.